//此文件是统一用来发送请求的，以便于将来维护或者管理接口  比如更改接口
// .ajax
import ajax from "./ajax";
import mockAjax from "./mockAjax";
// 1.发送请求，获取三级列表的数据
// export function reqCategoryListData(){
//     return ajax.get('/api/product/getBaseCategoryList')
// } 
export const reqCategoryListData = () => ajax.get('/product/getBaseCategoryList');

// 2. 获取轮播图的数据
export const reqGetBannerData = () => mockAjax.get("/bannerList")

//3.获取楼层信息
export const reqGetFloorsData = () => mockAjax.get("/floorsList")

// 4.获取搜索商品信息
export const reqGetGoodsData = (searchParams) => ajax.post("/list", searchParams)

// 5.获取商品详情页面的数据
export const reqDetailData = (skuId) => ajax.get('/item/' + skuId)

// 6.增加商品到购物车，或者更改购物车商品状态
export const reqAddShopCart = (skuId,skuNum)=>ajax.post(`/cart/addToCart/${skuId}/${skuNum}`)

// 7.获取购物车商品列表信息
export const reqGetCartListData = ()=>ajax.get('cart/cartList')

// 8.获取商品选中状态的数据,更新购物车商品的选中状态，单选中的选中与否
export const reqCheckedData = (skuId,isChecked)=>ajax.get(`/cart/checkCart/${skuId}/${isChecked}`)

// 9. 批量更新购物车中商品的选中状态 
export const reqUpdateAllSkuInfoState = (isChecked, skuIdList) => ajax.post(`/cart/batchCheckCart/${isChecked}`, skuIdList)

// 10.请求删除购物车列表的一项
export const reqDeleteCart = (skuId)=>ajax.delete(`/cart/deleteCart/${skuId}`)


// 11.批量删除多条数据
export const reqDeleteChecked = (skuIdList)=>ajax.post(`/cart/batchDeleteCart`,skuIdList)

// 12.获取手机验证码
export const reqGetVerifyCode = (phone)=> ajax.get(`/user/passport/sendCode/${phone}`)

// 13.实现用户注册
export const reqRegisterUser = (user)=> ajax.post(`/user/passport/register`,user)

// 14.实现用户登录
export const reqUserLogin =(userInfo) => ajax.post('/user/passport/login',userInfo)

// 15. 用户登出功能  也就是用户退出
export const reqUserLogout = ()=> ajax.get('user/passport/logout')

// 16.收件人地址接口
export const reqGetUserAddressListData = () => ajax.get('/user/userAddress/auth/findUserAddressList')

// 17. trade 订单结算中心接口函数,订单交易页数据
export const reqGetTradeInfoData = () => ajax.get('/order/auth/trade')

// 18. 提交订单的接口函数
export const reqSubmitOrder = (tradeNo,params)=>ajax.post(`/order/auth/submitOrder?tradeNo=${tradeNo}`,params)

// 19. 获取支付链接 
export const reqGetPayQRcode = (orderId) => ajax.get(`/payment/weixin/createNative/${orderId}`)

// 20. 查询订单支付状态
export const reqQueryPayStatus = (orderId) => ajax.get(`/payment/weixin/queryPayStatus/${orderId}`)

// 21. 查询订单中心列表 就是之前已经支付过钱的商品列表中心
export const reqGetCenterListData = (page,limit)=> ajax.get(`/order/auth/${page}/${limit}`)